<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
    *{margin:0;padding:0;}
    li{
        list-style: none;
        display:inline-block;
        line-height: 50px;
        cursor: pointer;
    }
    .form{
        width:300px;
        height:400px;
        border:1px solid #333;
        text-align: center;
    }
    ul{
        height:50px;
        border-bottom: 1px solid #333;
    }
    .content{
        width:300px;
        height:350px;
        position: relative;
    }
    .content>div{
        position: absolute;
        width:100%;
        height:100%;
    }
    .two{
        display: none;
    }
    .two img{
        margin-top: 30px;
        width:220px;
        height: 250px;
    }
    .current{
        color:orangered;
    }

    </style>
</head>
<body>
    <div class="form">
        <ul>
            <li class="current">账号登陆</li>
            <li>扫码登陆</li>
        </ul>
        <div class="content">
            <div class="one">
                <p>账号登陆</p>
            </div>
            <div class="two">
                <img src="images/01.png" alt="">
            </div>
        </div>
    </div>
    <script>
    var lis=document.getElementsByTagName("li");
    var contents=document.querySelectorAll(".content>div");
    // 点击换色
    for(var i=0;i<lis.length;i++){
        lis[i].index=i;
        lis[i].onclick=function(){
            for(var k=0;k<lis.length;k++){
                lis[k].className="";
            }
            this.className="current";
            // 让对应的conten显示
            for(var m=0;m<contents.length;m++){
                contents[m].style.display="none";
            }
            contents[this.index].style.display="block"
        }
    }
    </script>
</body>
</html>